// yb_shop/pages/form/index.js
var app=getApp(),
  a = app.requirejs("core"),
f = app.requirejs("api/index");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    route: "form",
    menu: app.tabBar,
    menu_show: false,
    config: app.config,
    default_pic:'/yb_shop/static/images/add_pic.jpg',
      show:false,
      form: [],
      data:{}
  },
  //底部导航跳转
  menu_url: function (k) {
    a.menu_url(k, 2);
  },
  formSubmit:function(e){
      var form_id=e.detail.formId;
    f.formSubmit(this, e, form_id);
    
  },
  bindPickerChange: function (e) {
    f.bindPickerChange(this,e);
  },
   listen_time_two:function(e){
     f.listen_time_two(this,e);
  },
   chooseImageTap1: function (e) {
     var id = a.pdata(e).id;
     f.upload(this, id, 'form_pic', 1)
   },
   chooseImageTap2: function (e) {
     var id=a.pdata(e).id;
     f.upload(this,id, 'form_pic', 0)
   },
   Image_del: function (e) {
     f.Image_del(this,e);
   },
  /**
    * 生命周期函数--监听页面显示
    */
  get_list: function () {
    var id=this.data.id;
    "" == app.getCache("userinfo") && (a.toast('您还没登录呢'),
      setTimeout(function () {
        wx.redirectTo({
          url: "/yb_shop/pages/index/index"
        })
      }, 1e3));
    f.get_form_list(1,id,this);
  },
 
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   
    if (options != null && options != undefined) {
      this.setData({
        tabbar_index: options.tabbar_index ? options.tabbar_index : -1
      });
    }

    a.setting();
    this.setData({
      menu: getApp().tabBar
    })
    options.item = { param: options.id };
    this.setData(options);

    if (this.data.tabbar_index >= 0) {
      this.setData({
        showtabbar: true,
      })
    }
    
    this.get_list();
  },
 
  
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})